#define _CRT_SECURE_NO_WARNINGS 1
#pragma warning(disable : 6031)
#include "SeqList.h"

void initsl(sl* pc)
{
	sl* p = (sl*)malloc(sizeof(type) * 4);
	if (!p)
	{
		perror("malloc");
		return;
	}
	pc->a = p;
	pc->num = 0;
	pc->sz = 0;
}

void checksl(sl* pc)
{
	if (pc->sz == pc->num)
	{
		sl* p = (sl*)realloc(pc->a, sizeof(type) * 4 * 2);
		if (!p)
		{
			perror("realloc");
		}
		pc->a = p;
		pc->num += 4;
	}
}

void pushbacksl(sl* pc, type a)
{
	checksl(pc);
	pc->a[pc->sz] = a;
	pc->sz++;
}


void backsl(sl* pc)
{
	free(pc->a);
	pc->a = 0;
	pc->num = 0;
	pc->sz = 0;
}